package com.lse_from.utils

import com.lse_from.dto.Froms
import org.springframework.stereotype.Component
import java.math.BigDecimal
import java.time.LocalDate
import java.time.LocalTime

/**
 * JSON 生成dto service mapper controller等
 *
 * @author 祁雪
 */
@Component
class JSONToBean {

    lateinit var fileSavePath: String

    lateinit var templatePath: String

    val typeMap = mapOf<String, String>(
        "input" to "String",
        "number" to "BigDecimal",
        "select" to "String",
        "time" to "String",
        "date" to "String",
        "switch" to "String",
        "radio" to "String",
        "checkbox" to "String"
    )

    /**
     * 创建表单数据库
     */
    fun createDBByForm() {

    }

    /**
     * 生成实体
     */
    fun createEntity(froms: Froms, list: List<Map<String, Any?>>) {

    }

}

fun main() {
    PubUtil.createFileByFtl(
        "C:\\Users\\76167\\Desktop\\文档数据\\test",
        "Test.java",
        "D:\\project\\IdeaWork\\lse_from\\src\\main\\resources\\template\\",
        "Entity.ftl",
        mapOf<String, Any>(
            "className" to "Test",
            "package" to "com.test",
            "params" to listOf<Any>(
                mapOf(
                    "name" to "a",
                    "type" to "String",
                    "funName" to "A",
                    "comment" to "a测试"
                ),
                mapOf(
                    "name" to "b",
                    "type" to "int",
                    "funName" to "B",
                    "comment" to "b测试"
                )
            )
        )
    )
}